﻿using SqlSugar;
using System;
using System.Threading.Tasks;
using Volo.Abp;

namespace Acme.BookStore.Bass
{
    /// <summary>
    ///
    /// </summary>
    /// <typeparam name="TEntity"></typeparam>
    public class BasRepository : SqlSugarRepository<Bas>, IBasRepository
    {
        public BasRepository(IServiceProvider serviceProvider, SqlSugarScope db) : base(serviceProvider, db)
        {
        }

        public new async Task<Bas> InsertAsync(Bas entity)
        {
            var db = Context;
            var r = await db.Insertable(entity).ExecuteReturnEntityAsync();
            if (entity.Code == "e") throw new BusinessException("cnmd");

            return r;
        }
    }
}